home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / CDTools / MUIRexx / demos / MUIRexxBuild / set_object.rexx < prev    next >
OS/2 REXX Batch file  |  1997-04-21  |  15KB  |  568 lines

  1. /* */
  2. options results
  3. parse arg '['obj']'
  4.  
  5. address BUILD
  6.  
  7. parse var obj gobj .
  8. select
  9.     when index(gobj,'window') > 0 then call set_window(obj)
  10.     when index(gobj,'group') > 0 then call set_group(obj)
  11.     when index(gobj,'menu') > 0 then call set_menu(obj)
  12.     when index(gobj,'do') > 0 then call set_do(obj)
  13.     when index(gobj,'item') > 0 then call set_item(obj)
  14.     when index(gobj,'space') > 0 then call set_space(obj)
  15.     when index(gobj,'label') > 0 then call set_label(obj)
  16.     when index(gobj,'view') > 0 then call set_view(obj)
  17.     when index(gobj,'gauge') > 0 then call set_gauge(obj)
  18.     when index(gobj,'meter') > 0 then call set_gauge(obj)
  19.     when index(gobj,'button') > 0 then call set_gadget(obj)
  20.     when index(gobj,'text') > 0 then call set_gadget(obj)
  21.     when index(gobj,'switch') > 0 then call set_gadget(obj)
  22.     when index(gobj,'image') > 0 then call set_gadget(obj)
  23.     when index(gobj,'check') > 0 then call set_gadget(obj)
  24.     when index(gobj,'cycle') > 0 then call set_cycle(obj)
  25.     when index(gobj,'radio') > 0 then call set_cycle(obj)
  26.     when index(gobj,'string') > 0 then call set_string(obj)
  27.     when index(gobj,'popasl') > 0 then call set_popasl(obj)
  28.     when index(gobj,'poplist') > 0 then call set_popasl(obj)
  29.     when index(gobj,'slider') > 0 then call set_slider(obj)
  30.     when index(gobj,'popslider') > 0 then call set_slider(obj)
  31.     when index(gobj,'knob') > 0 then call set_slider(obj)
  32.     when index(gobj,'dirlist') > 0 then call set_dirlist(obj)
  33.     when index(gobj,'volumelist') > 0 then call set_volumelist(obj)
  34.     when index(gobj,'list') > 0 then call set_list(obj)
  35.     when index(gobj,'object') > 0 then call set_object(obj)
  36.     when index(gobj,'application') > 0 then call set_application(obj)
  37.     when index(gobj,'method') > 0 then call set_method(obj)
  38.     when index(gobj,'callhook') > 0 then call set_callhook(obj)
  39.     otherwise call set_generic(obj)
  40. end
  41.  
  42. exit
  43.  
  44. set_window: procedure
  45. parse arg obj
  46.  
  47. line = obj
  48. string ID S1
  49. if result ~= '' then line = line||' ID '||addobj(result)
  50. popasl ID S2
  51. if result ~= '' then line = line||' COMMAND """'||result||'"""'
  52. string ID S3
  53. if result ~= '' then line = line||' PORT '||result
  54. string ID S4
  55. if result ~= '' then line = line||' TITLE """'||result||'"""'
  56. line = line||get_attrs()
  57. call finish line
  58. return
  59.  
  60. set_group: procedure
  61. parse arg obj
  62.  
  63. line = obj
  64. string ID S1
  65. if result ~= '' then line = line||' ID '||addobj(result)
  66. string ID S2
  67. if result ~= '' then line = line||' HELP """'||result||'"""'
  68. string ID S3
  69. if result ~= '' then line = line||' NODE '||result
  70. check ID C1
  71. if result then line = line||' FRAME'
  72. check ID C2
  73. if result then line = line||' HORIZ'
  74. cycle ID L1
  75. gtype = result
  76. if gtype ~= 'NORMAL' then line = line||' '||upper(gtype)
  77. if gtype = 'POP' then do
  78.     cycle ID L2
  79.     type = result
  80.     select
  81.         when type = 'Icon' then do
  82.             popasl ID S7
  83.             name = result
  84.             if name ~= '' then line = line||' ICON "'||name||'"'
  85.         end
  86.         when type = 'Image' then do
  87.             poplist ID S8
  88.             sval = result
  89.             sname = sval
  90.             call open('images','build:images.lst','R')
  91.             do while ~eof('images')
  92.                 iline = readln('images')
  93.                 if iline = '' then leave
  94.                 parse var iline vname '=' value .
  95.                 if index(vname,sname) > 0 then do
  96.                     sval = value
  97.                     leave
  98.                 end
  99.             end
  100.             call close('images')
  101.             line = line||' SPEC "'||'6:'sval||'"'
  102.         end
  103.         otherwise nop
  104.     end
  105. end
  106. line = line||get_attrs()
  107. string ID S4
  108. if result ~= '' then line = line||' LABELS "'||result||'"'
  109. call finish line
  110. return
  111.  
  112. set_menu: procedure
  113. parse arg obj
  114.  
  115. line = obj
  116. string ID S1
  117. if result ~= '' then line = line||' ID '||addobj(result)
  118. line = line||get_attrs()
  119. string ID S2
  120. if result ~= '' then line = line||' LABEL "'||result||'"'
  121. call finish line
  122. return
  123.  
  124. set_do: procedure
  125. parse arg obj
  126.  
  127. line = obj
  128. string ID P1
  129. if result ~= '' then line = line||' '||strip(result)
  130. string ID P2
  131. if result ~= '' then line = line||' = '||strip(result)
  132. string ID P3
  133. if result ~= '' then line = line||' to '||strip(result)
  134. call finish line
  135. return
  136.  
  137. set_item: procedure
  138. parse arg obj
  139.  
  140. line = obj
  141. string ID S1
  142. if result ~= '' then line = line||' ID '||addobj(result)
  143. popasl ID S2
  144. if result ~= '' then line = line||' COMMAND """'||result||'"""'
  145. string ID S3
  146. if result ~= '' then line = line||' PORT '||result
  147. line = line||get_attrs()
  148. string ID S4
  149. if result ~= '' then line = line||' LABEL "'||result||'"'
  150. call finish line
  151. return
  152.  
  153. set_space: procedure
  154. parse arg obj
  155.  
  156. line = obj
  157. check ID C1
  158. if result then line = line||' BAR'
  159. check ID C2
  160. if result then line = line||' HORIZ'
  161. string ID S1
  162. if result ~= '' then line = line||' '||result
  163. call finish line
  164. return
  165.  
  166. set_label: procedure
  167. parse arg obj
  168.  
  169. line = obj
  170. check ID C1
  171. if result then line = line||' LEFT'
  172. check ID C2
  173. if result then line = line||' CENTER'
  174. check ID C3
  175. if result then line = line||' SINGLE'
  176. check ID C4
  177. if result then line = line||' DOUBLE'
  178. string ID S1
  179. if result ~= '' then line = line||' "'||result||'"'
  180. call finish line
  181. return
  182.  
  183. set_view: procedure
  184. parse arg obj
  185.  
  186. line = obj
  187. string ID S1
  188. if result ~= '' then line = line||' ID '||addobj(result)
  189. string ID S2
  190. if result ~= '' then line = line||' HELP """'||result||'"""'
  191. string ID S3
  192. if result ~= '' then line = line||' NODE '||result
  193. popasl ID S4
  194. if result ~= '' then line = line||' FILE "'||result'"'
  195. line = line||get_attrs()
  196. string ID S5
  197. if result ~= '' then line = line||' STRING "'||result||'"'
  198. call finish line
  199. return
  200.  
  201. set_gauge: procedure
  202. parse arg obj
  203.  
  204. line = obj
  205. string ID S1
  206. if result ~= '' then line = line||' ID '||addobj(result)
  207. string ID S2
  208. if result ~= '' then line = line||' HELP """'||result||'"""'
  209. string ID S3
  210. if result ~= '' then line = line||' NODE '||result
  211. line = line||get_attrs()
  212. string ID S4
  213. if result ~= '' then line = line||' LABEL "'||result||'"'
  214. call finish line
  215. return
  216.  
  217. set_gadget: procedure
  218. parse arg obj
  219.  
  220. line = obj
  221. string ID S1
  222. if result ~= '' then line = line||' ID '||addobj(result)
  223. popasl ID S2
  224. if result ~= '' then line = line||' COMMAND """'||result||'"""'
  225. string ID S3
  226. if result ~= '' then line = line||' PORT '||result
  227. string ID S4
  228. if result ~= '' then line = line||' HELP """'||result||'"""'
  229. string ID S5
  230. if result ~= '' then line = line||' NODE '||result
  231. cycle ID L2
  232. type = result
  233. select
  234.     when type = 'Icon' then do
  235.         popasl ID S7
  236.         name = result
  237.         if name ~= '' then line = line||' ICON "'||name||'"'
  238.     end
  239.     when type = 'Image' then do
  240.         poplist ID S8
  241.         sval = result
  242.         sname = sval
  243.         call open('images','build:images.lst','R')
  244.         do while ~eof('images')
  245.             iline = readln('images')
  246.             if iline = '' then leave
  247.             parse var iline vname '=' value .
  248.             if index(vname,sname) > 0 then do
  249.                 sval = value
  250.                 leave
  251.             end
  252.         end
  253.         call close('images')
  254.         line = line||' SPEC "'||'6:'sval||'"'
  255.     end
  256.     when type = 'Picture' then do
  257.         popasl ID S7
  258.         name = result
  259.         if name ~= '' then do
  260.             line = line||' PICT "'||name||'"'
  261.             switch ID C1
  262.             if result = 'Transparent' then line = line||' TRANS'
  263.         end
  264.     end
  265.     otherwise nop
  266. end
  267. line = line||get_attrs()
  268. string ID S6
  269. if result ~= '' then line = line||' LABEL "'||result||'"'
  270. call finish line
  271. return
  272.  
  273. set_cycle: procedure
  274. parse arg obj
  275.  
  276. line = obj
  277. string ID S1
  278. if result ~= '' then line = line||' ID '||addobj(result)
  279. popasl ID S2
  280. if result ~= '' then line = line||' COMMAND """'||result||'"""'
  281. string ID S3
  282. if result ~= '' then line = line||' PORT '||result
  283. string ID S4
  284. if result ~= '' then line = line||' HELP """'||result||'"""'
  285. string ID S5
  286. if result ~= '' then line = line||' NODE '||result
  287. line = line||get_attrs()
  288. string ID S6
  289. if result ~= '' then line = line||' LABELS "'||result||'"'
  290. call finish line
  291. return
  292.  
  293. set_string: procedure
  294. parse arg obj
  295.  
  296. line = obj
  297. string ID S1
  298. if result ~= '' then line = line||' ID '||addobj(result)
  299. popasl ID S2
  300. if result ~= '' then line = line||' COMMAND """'||result||'"""'
  301. string ID S3
  302. if result ~= '' then line = line||' PORT '||result
  303. string ID S4
  304. if result ~= '' then line = line||' HELP """'||result||'"""'
  305. string ID S5
  306. if result ~= '' then line = line||' NODE '||result
  307. line = line||get_attrs()
  308. string ID S6
  309. if result ~= '' then line = line||' CONTENT "'||result||'"'
  310. call finish line
  311. return
  312.  
  313. set_popasl: procedure
  314. parse arg obj
  315.  
  316. line = obj
  317. string ID S1
  318. if result ~= '' then line = line||' ID '||addobj(result)
  319. popasl ID S2
  320. if result ~= '' then line = line||' COMMAND """'||result||'"""'
  321. string ID S3
  322. if result ~= '' then line = line||' PORT '||result
  323. string ID S4
  324. if result ~= '' then line = line||' HELP """'||result||'"""'
  325. string ID S5
  326. if result ~= '' then line = line||' NODE '||result
  327. cycle ID R1
  328. spec = result
  329. poplist ID S8
  330. sval = result
  331. if spec = 6 then do
  332.     sname = sval
  333.     call open('images','build:images.lst','R')
  334.     do while ~eof('images')
  335.         iline = readln('images')
  336.         if iline = '' then leave
  337.         parse var iline vname '=' value .
  338.         if index(vname,sname) > 0 then do
  339.             sval = value
  340.             leave
  341.         end
  342.     end
  343.     call close('images')
  344.     if sval = 18 then sval = ''
  345. end
  346. if sval ~= '' then line = line||' SPEC "'||spec':'sval||'"'
  347. if index(obj,'poplist') > 0 then do
  348.     string ID S7
  349.     if result ~= '' then line = line||' LABELS """'||result||'"""'
  350. end
  351. line = line||get_attrs()
  352. string ID S6
  353. if result ~= '' then line = line||' CONTENT "'||result||'"'
  354. call finish line
  355. return
  356.  
  357. set_slider: procedure
  358. parse arg obj
  359.  
  360. line = obj
  361. string ID S1
  362. if result ~= '' then line = line||' ID '||addobj(result)
  363. popasl ID S2
  364. if result ~= '' then line = line||' COMMAND """'||result||'"""'
  365. string ID S3
  366. if result ~= '' then line = line||' PORT '||result
  367. string ID S4
  368. if result ~= '' then line = line||' HELP """'||result||'"""'
  369. string ID S5
  370. if result ~= '' then line = line||' NODE '||result
  371. line = line||get_attrs()
  372. call finish line
  373. return
  374.  
  375. set_list: procedure
  376. parse arg obj
  377.  
  378. line = obj
  379. string ID S1
  380. if result ~= '' then line = line||' ID '||addobj(result)
  381. popasl ID S2
  382. if result ~= '' then line = line||' COMMAND """'||result||'"""'
  383. string ID S3
  384. if result ~= '' then line = line||' PORT '||result
  385. string ID S4
  386. if result ~= '' then line = line||' HELP """'||result||'"""'
  387. string ID S5
  388. if result ~= '' then line = line||' NODE '||result
  389. string ID S6
  390. if result ~= '' then line = line||' TITLE """'||result||'"""'
  391. string ID S7
  392. if result ~= '' then line = line||' POS '||result
  393. check ID C1
  394. if result then line = line||' INSERT'
  395. check ID C2
  396. if result then line = line||' NODUP'
  397. check ID C3
  398. if result then line = line||' TOGGLE'
  399. line = line||get_attrs()
  400. string ID S8
  401. if result ~= '' then line = line||' STRING '||result
  402. call finish line
  403. return
  404.  
  405. set_dirlist: procedure
  406. parse arg obj
  407.  
  408. line = obj
  409. string ID S1
  410. if result ~= '' then line = line||' ID '||addobj(result)
  411. popasl ID S2
  412. if result ~= '' then line = line||' COMMAND """'||result||'"""'
  413. string ID S3
  414. if result ~= '' then line = line||' PORT '||result
  415. string ID S4
  416. if result ~= '' then line = line||' HELP """'||result||'"""'
  417. string ID S5
  418. if result ~= '' then line = line||' NODE '||result
  419. string ID S6
  420. if result ~= '' then line = line||' PATH "'||result||'"'
  421. string ID S7
  422. if result ~= '' then line = line||' PATTERN "'||result||'"'
  423. check ID C1
  424. if result then line = line||' REREAD'
  425. check ID C2
  426. if result then line = line||' TOGGLE'
  427. line = line||get_attrs()
  428. call finish line
  429. return
  430.  
  431. set_volumelist: procedure
  432. parse arg obj
  433.  
  434. line = obj
  435. string ID S1
  436. if result ~= '' then line = line||' ID '||addobj(result)
  437. popasl ID S2
  438. if result ~= '' then line = line||' COMMAND """'||result||'"""'
  439. string ID S3
  440. if result ~= '' then line = line||' PORT '||result
  441. string ID S4
  442. if result ~= '' then line = line||' HELP """'||result||'"""'
  443. string ID S5
  444. if result ~= '' then line = line||' NODE '||result
  445. line = line||get_attrs()
  446. call finish line
  447. return
  448.  
  449. set_object: procedure
  450. parse arg obj
  451.  
  452. line = obj
  453. string ID S1
  454. if result ~= '' then line = line||' ID '||addobj(result)
  455. popasl ID S2
  456. if result ~= '' then line = line||' COMMAND """'||result||'"""'
  457. string ID S3
  458. if result ~= '' then line = line||' PORT '||result
  459. string ID S4
  460. if result ~= '' then line = line||' HELP """'||result||'"""'
  461. string ID S5
  462. if result ~= '' then line = line||' NODE '||result
  463. string ID S6
  464. if result ~= '' then line = line||' CLASS "'||result||'"'
  465. check ID C1
  466. if result then line = line||' BOOPSI'
  467. line = line||get_attrs()
  468. call finish line
  469. return
  470.  
  471. set_application: procedure
  472. parse arg obj
  473.  
  474. line = obj||get_attrs()
  475. call finish line
  476. return
  477.  
  478. set_method: procedure
  479. parse arg obj
  480.  
  481. line = obj
  482. string ID S1
  483. if result ~= '' then line = line||' ID '||result
  484. i = 0
  485. do forever
  486.     list ID ALST POS i
  487.     aname = result
  488.     if aname = '' then break
  489.     line = line||' '||strip(aname)
  490.     i = i + 1
  491. end
  492. call finish line
  493. return
  494.  
  495. set_callhook: procedure
  496. parse arg obj
  497.  
  498. Selected =                        0x8042654b /* V4  isg BOOL              */
  499.  
  500. line = obj
  501. string ID S1
  502. if result ~= '' then line = line||' ID '||result
  503. switch ID C1 ATTRS Selected
  504. if result then line = line||' PRESS'
  505. switch ID C2 ATTRS Selected
  506. if result then line = line||' APP'
  507. switch ID C3 ATTRS Selected
  508. if result then line = line||' DROP'
  509. popasl ID S2
  510. if result ~= '' then line = line||' COMMAND """'||result||'"""'
  511. string ID S3
  512. if result ~= '' then line = line||' PORT '||result
  513. string ID S4
  514. if result ~= '' then do
  515.     line = line||' ATTRS '||result
  516.     string ID S5
  517.     if result ~= '' then line = line||' '||result
  518. end
  519. string ID S6
  520. if result ~= '' then line = line||' INCLUDE "'||result||'"'
  521. string ID S7
  522. if result ~= '' then line = line||' EXCLUDE "'||result||'"'
  523. call finish line
  524. return
  525.  
  526. set_generic: procedure
  527.  
  528. line = ''
  529. string ID P1
  530. if result ~= '' then line = result
  531. call finish line
  532. return
  533.  
  534. finish: procedure
  535. parse arg line
  536.  
  537. List_Active =                     0x8042391c /* V4  isg LONG              */
  538.  
  539. window ID SET CLOSE
  540. list ID DLST ATTRS List_Active
  541. n = result
  542. list ID DLST POS n STRING '='||line
  543. return
  544.  
  545. get_attrs: procedure
  546.  
  547. line = ''
  548. i = 0
  549. do forever
  550.     list ID ALST POS i
  551.     aname = result
  552.     if aname = '' then break
  553.     if i = 0 then line = line||' ATTRS'
  554.     parse var aname name','value
  555.     if strip(value) ~= '' then line = line||' '||strip(name)||' '||strip(value)
  556.     i = i + 1
  557. end
  558. return line
  559.  
  560. addobj: procedure
  561. parse arg obj
  562.  
  563. getvar objlist
  564. objects = result
  565. if index(objects,obj) = 0 then objects = objects||obj||','
  566. setvar objlist objects
  567. return obj
  568.